namespace PMS.Common
{
    using PMS.Model;
    using System;
    using System.Collections.Generic;
    using System.Runtime.CompilerServices;
    using System.Text;

    public class Keys
    {
        private static List<AuthorityOrgan> _AuthorityOrganList;
        private static StringBuilder allOrganIDListString = new StringBuilder();

        public static string GetAllOrganIDList(int oid)
        {
            allOrganIDListString.Clear();
            allOrganIDListString.Append(oid);
            ReutrnOrganIDList(oid);
            return allOrganIDListString.ToString();
        }

        private static void ReutrnOrganIDList(int oid)
        {
            List<AuthorityOrgan> list = AuthorityOrganList.FindAll(delegate (AuthorityOrgan f) {
                int? parentID = f.ParentID;
                int num1 = oid;
                return (parentID.GetValueOrDefault() == num1) && parentID.HasValue;
            });
            if (list.Count > 0)
            {
                list.ForEach(delegate (AuthorityOrgan f) {
                    allOrganIDListString.Append(",");
                    allOrganIDListString.Append(f.OrganID);
                    ReutrnOrganIDList(f.OrganID);
                });
            }
        }

        private static PMS.Model.Admin _Admin = null;
        public static PMS.Model.Admin Admin
        {
            [CompilerGenerated]
            get
            {
                return _Admin;
            }
            [CompilerGenerated]
            set
            {
                 _Admin= value;
            }
        }

        public static List<AuthorityOrgan> AuthorityOrganList
        {
            get
            {
                if (_AuthorityOrganList == null)
                {
                    _AuthorityOrganList = new List<AuthorityOrgan>();
                }
                return _AuthorityOrganList;
            }
            set
            {
                _AuthorityOrganList = value;
            }
        }
    }
}

